package skipass.command;

import mycollections.MyLinkedList;
import mycollections.MyQueue;

public class CommandChain {

	MyQueue<Command> commandQueue = new MyLinkedList<>();
	
	public void addCommand(Command com) {
		commandQueue.offer(com);
	}
	
	public boolean executeChain() {
		boolean result = true;
		while(commandQueue.peek() != null && result == true) {
			result = commandQueue.poll().execute();			
		}
		return result;
	}
	
}
